-- ModuleM
-- Create by zouyb
-- 逻辑模块统一处理代码可以写在这里

module("ModuleM", package.seeall);

-- 初始化
function init()
    -- 预先绑定逻辑模块和事件名，因为目前StartLogic中不会加载所有模块
    -- 有些在特定模块中init函数里面注册的函数将会失效。
    -- 解决方案是在这里预先做一次模块名和事件的绑定

    EventMgr.bind("AdM", event.LOGIN_OK);
    EventMgr.bind("AdM", event.DISMISS_AD_SCREEN);
    EventMgr.bind("AdM", event.CLICK_AD);
    EventMgr.bind("AdM", event.AD_READY_STATE);
    EventMgr.bind("AdM", event.AD_COMPLETED);

    EventMgr.bind("ArtifactM", event.DO_BONUS);

    EventMgr.bind("AutoFightM", event.START_NEXT_FLOOR);
    EventMgr.bind("AutoFightM", event.DUNGEON_AREADY);
    EventMgr.bind("AutoFightM", event.LEAVE_DUNGEON);
    EventMgr.bind("AutoFightM", event.HERO_DIE);
    EventMgr.bind("AutoFightM", event.WISH_TRIGGER);
    EventMgr.bind("AutoFightM", event.BOSS_SHOW);
    EventMgr.bind("AutoFightM", event.MONSTER_CLEAR);
    EventMgr.bind("AutoFightM", event.DO_ALTAR_EVENT);
    EventMgr.bind("AutoFightM", event.DUNGEON_PASS);

    EventMgr.bind("AvalonFortM", event.DUNGEON_PREPARE_OVER);
    EventMgr.bind("AvalonFortM", event.HERO_REVIVE);

    EventMgr.bind("BeehiveM", event.NEXT_FLOOR);

    EventMgr.bind("BineM", event.NEXT_FLOOR);
    EventMgr.bind("BineM", event.LEAVE_DUNGEON);
    EventMgr.bind("BineM", event.END_ROUND);
    EventMgr.bind("BineM", event.START_PACK_VERIFY_RESULT);
    EventMgr.bind("BineM", event.DUNGEON_AREADY);
    EventMgr.bind("BineM", event.BACK_FLOOR);

    EventMgr.bind("CreationGateM", event.LEAVE_DUNGEON);

    EventMgr.bind("CombatM", event.COMBAT_ROUND);
    EventMgr.bind("CombatM", event.LOGIN_OK);

    EventMgr.bind("CompoundM", event.BONUS_ITEM);

    EventMgr.bind("DailyTaskM", event.LEAVE_DUNGEON);
    EventMgr.bind("DailyTaskM", event.DUNGEON_AREADY);
    EventMgr.bind("DailyTaskM", event.PICK_UP_ITEM);
    EventMgr.bind("DailyTaskM", event.MONSTER_DIE_LOGIC);
    EventMgr.bind("DailyTaskM", event.MOP_UP_DONE);

    EventMgr.bind("DailyItemStatM", event.DO_BONUS);

    EventMgr.bind("DemonStatueM", event.LEAVE_DUNGEON);

    EventMgr.bind("DesertAltarM", event.LEAVE_DUNGEON);

    EventMgr.bind("DragonWishM", event.BONUS_ITEM);
    EventMgr.bind("DragonWishM", event.MINE_HILL_BONE_DRY);

    EventMgr.bind("DungeonBossM", event.START_DUNGEON);

    EventMgr.bind("DungeonBossM", event.BOSS_DIE);

    EventMgr.bind("DungeonInstanceM", event.START_DUNGEON);
    EventMgr.bind("DungeonInstanceM", event.LEAVE_DUNGEON);
    EventMgr.bind("DungeonInstanceM", event.NEXT_FLOOR);
    EventMgr.bind("DungeonInstanceM", event.BACK_FLOOR);

    EventMgr.bind("DungeonLabM", event.LEAVE_DUNGEON);

    EventMgr.bind("DungeonLogM", event.LOGIN_OK);
    EventMgr.bind("DungeonLogM", event.MESSAGE_DONE);

    EventMgr.bind("DungeonM", event.LOGIN_OK);

    EventMgr.bind("DungeonMineM", event.HERO_DIE);
    EventMgr.bind("DungeonMineM", event.NEXT_FLOOR);
    EventMgr.bind("DungeonMineM", event.LEAVE_DUNGEON);

    EventMgr.bind("DungeonServiceM", event.LEAVE_DUNGEON);
    EventMgr.bind("DungeonServiceM", event.START_DUNGEON);
    EventMgr.bind("DungeonServiceM", event.OPEN_GRID);
    EventMgr.bind("DungeonServiceM", event.PURE_OPEN_GRID);
    EventMgr.bind("DungeonServiceM", event.RESPOEN_ACK);
    EventMgr.bind("DungeonServiceM", event.INSTANCE_DISAPPER);
    EventMgr.bind("DungeonServiceM", event.DUNGEON_AREADY);
    EventMgr.bind("DungeonServiceM", event.DO_BONUS);
    EventMgr.bind("DungeonServiceM", event.PICK_UP_ITEM);
    EventMgr.bind("DungeonServiceM", event.COMBAT_ROUND);

    EventMgr.bind("DungeonShopM", event.LEAVE_DUNGEON);
    EventMgr.bind("DungeonShopM", event.NEXT_FLOOR);
    EventMgr.bind("DungeonShopM", event.DO_BONUS);

    EventMgr.bind("DungeonStatM", event.LEAVE_DUNGEON);
    EventMgr.bind("DungeonStatM", event.BACK_FLOOR);

    EventMgr.bind("DungeonTaskM", event.LEAVE_DUNGEON);

    EventMgr.bind("DungeonTentM", event.START_ROUND);
    EventMgr.bind("DungeonTentM", event.LEAVE_DUNGEON);
    EventMgr.bind("DungeonTentM", event.NEXT_FLOOR);
    EventMgr.bind("DungeonTentM", event.BACK_FLOOR);

    EventMgr.bind("BossTentM", event.START_ROUND);
    EventMgr.bind("BossTentM", event.LEAVE_DUNGEON);
    EventMgr.bind("BossTentM", event.NEXT_FLOOR);
    EventMgr.bind("BossTentM", event.BACK_FLOOR);

    EventMgr.bind("DungeonSkyCombatM", event.DUNGEON_SKY_COMBAT_START);

    EventMgr.bind("ElementAltarM", event.DUNGEON_AREADY);

    EventMgr.bind("ElementMagicM", event.RERESH_PROP);

    EventMgr.bind("GhostShipM", event.NEXT_FLOOR);
    EventMgr.bind("GhostShipM", event.LEAVE_DUNGEON);
    EventMgr.bind("GhostShipM", event.END_ROUND);

    EventMgr.bind("GroupPurchaseM", event.BUY_GOODS);

    EventMgr.bind("HolyItemsM", event.LEAVE_DUNGEON);

    EventMgr.bind("LoginM", event.MESSAGE_DONE)
    EventMgr.bind("LoginM", event.NETWORK_DISCONNECTED);
    EventMgr.bind("LoginM", event.NETWORK_CONNECTED);
    EventMgr.bind("LoginM", event.NETWORK_CONNECT_TIMEOUT);

    EventMgr.bind("MagicStoneM", event.LEAVE_DUNGEON);
    EventMgr.bind("MagicStoneM", event.NEXT_FLOOR);
    EventMgr.bind("MagicStoneM", event.END_ROUND);
    EventMgr.bind("MagicStoneM", event.OPEN_GRID);
    EventMgr.bind("MagicStoneM", event.PURE_OPEN_GRID);
    EventMgr.bind("MagicStoneM", event.CHANGE_GRID_STATE);

    EventMgr.bind("SteamMachineM", event.OPEN_GRID);
    EventMgr.bind("SteamMachineM", event.PURE_OPEN_GRID);
    EventMgr.bind("SteamMachineM", event.DUNGEON_SKY_COMBAT);

    EventMgr.bind("MarketM", event.LOGIN_OK);
    EventMgr.bind("MarketM", event.RECHARGE_OK);
    EventMgr.bind("MarketM", event.RECHARGE_FAIL);
    EventMgr.bind("MarketM", event.DUNGEON_PASS);

    EventMgr.bind("GiftM", event.BUY_GOODS);

    EventMgr.bind("MonsterM", event.USE_SPELL);
    EventMgr.bind("MonsterM", event.USE_STONE_MAGIC);
    EventMgr.bind("MonsterM", event.OPEN_GRID);
    EventMgr.bind("MonsterM", event.GRID_REFRESH_MONSTER);
    EventMgr.bind("MonsterM", event.BOSS_SHOW);
    EventMgr.bind("MonsterM", event.ENTER_UNREAL_DUNGEON);
    EventMgr.bind("MonsterM", event.ENTER_DUNGEON_INSTANCE);
    EventMgr.bind("MonsterM", event.MONSTER_TRANSFORM);

    EventMgr.bind("AssistMonsterM", event.MONSTER_DIE_LOGIC);
    EventMgr.bind("AssistMonsterM", event.OPEN_GRID);
    EventMgr.bind("AssistMonsterM", event.PURE_OPEN_GRID);
    EventMgr.bind("AssistMonsterM", event.CALL_SUMMON);
    EventMgr.bind("AssistMonsterM", event.SUMMON_DIE);

    EventMgr.bind("MsgReminderM", event.LEAVE_DUNGEON);

    EventMgr.bind("NewbieDungeonM", event.ENTER_NEWBIE_DUNGEON);

    EventMgr.bind("PetM", event.LOGIN_OK);
    EventMgr.bind("PetM", event.DO_BONUS);

    EventMgr.bind("PropertyM", event.DO_BONUS);

    EventMgr.bind("PropM", event.APPLY_SKILL);
    EventMgr.bind("PropM", event.HERO_DAMAGED_RESULT);
    EventMgr.bind("PropM", event.MONSTER_DIE_LOGIC);
    EventMgr.bind("PropM", event.USE_SPELL);

    EventMgr.bind("PropStatM", event.LEAVE_DUNGEON);

    EventMgr.bind("RestRoomM", event.LEAVE_DUNGEON);
    EventMgr.bind("RestRoomM", event.INSTANCE_DISAPPER);

    EventMgr.bind("ShapeChangeM", event.COST_ATTRIB);
    EventMgr.bind("ShapeChangeM", event.BONUS_ATTRIB);

    EventMgr.bind("SimpleEncryptM", event.GAIN_PET);
    EventMgr.bind("SimpleEncryptM", event.ITEM_COUNT_UPDATED);
    EventMgr.bind("SimpleEncryptM", event.UPDATE_ACHIEVEMENT);

    EventMgr.bind("SelfDestructM", event.LEAVE_DUNGEON);
    EventMgr.bind("SelfDestructM", event.EQUIP);
    EventMgr.bind("SelfDestructM", event.UNEQUIP);
    EventMgr.bind("SelfDestructM", event.START_DUNGEON);

    EventMgr.bind("SkyCombatM", event.SKY_COMBAT_END);
    EventMgr.bind("SkyCombatM", event.SKY_COMBAT_SEQUENCEN_FREE);

    EventMgr.bind("SummonM", event.DUNGEON_AREADY);
    EventMgr.bind("SummonM", event.LEAVE_DUNGEON);
    EventMgr.bind("SummonM", event.NEXT_FLOOR);
    EventMgr.bind("SummonM", event.SUMMON_DIE);
    EventMgr.bind("SummonM", event.END_ROUND);
    EventMgr.bind("SummonM", event.COST_SP_HERO_REVIVE);
    EventMgr.bind("SummonM", event.BACK_FLOOR);

    EventMgr.bind("SyncM", event.LOGIN_OK);

    EventMgr.bind("TalentM", event.GAIN_PET);

    EventMgr.bind("UserM", event.DO_BONUS);
    EventMgr.bind("UserM", event.LOGIN_OK);

    EventMgr.bind("ArenaM", event.LEAVE_DUNGEON);
    EventMgr.bind("ArenaM", event.START_NEXT_FLOOR);
    EventMgr.bind("ArenaM", event.ENTER_UNREAL_DUNGEON);

    EventMgr.bind("GameBoardM", event.USER_INFO_UPDATED);

    EventMgr.bind("SkyInstanceM", event.START_DUNGEON);
    EventMgr.bind("SkyInstanceM", event.PICK_UP_ITEM);
    EventMgr.bind("SkyInstanceM", event.BUILDING_EVENT_DONE);
    EventMgr.bind("SkyInstanceM", event.LEAVE_DUNGEON);
    EventMgr.bind("SkyInstanceM", event.BOSS_DIE);

    EventMgr.bind("TreeHouseM", event.NEXT_FLOOR);
    EventMgr.bind("TreeHouseM", event.LEAVE_DUNGEON);
    EventMgr.bind("TreeHouseM", event.END_ROUND);
    EventMgr.bind("TreeHouseM", event.BACK_FLOOR);
    EventMgr.bind("TreeHouseM", event.START_PACK_VERIFY_RESULT);

    EventMgr.bind("SkyRelicM", event.LOGIN_OK);
    EventMgr.bind("TriggerDialogM", event.SKY_CITY_EXPLORE);
    EventMgr.bind("TriggerDialogM", event.FIND_TREASURE_TEMPLE);

    EventMgr.bind("CaveHideItemM", event.LEAVE_DUNGEON);
    EventMgr.bind("CaveHideItemM", event.EQUIP);
    EventMgr.bind("CaveHideItemM", event.UPGRADE_EQUIP);
    EventMgr.bind("CaveHideItemM", event.TRY_LIGHT_CAVE);

    EventMgr.bind("ReagentM", event.LEAVE_DUNGEON_CLEAR_ITEM);
    EventMgr.bind("ReagentM", event.DUNGEON_AREADY);

    EventMgr.bind("TestFightM", event.MESSAGE_DONE);
    EventMgr.bind("TestFightM", event.HERO_DIE);
    EventMgr.bind("TestFightM", event.WISH_TRIGGER);
    EventMgr.bind("TestFightM", event.DUNGEON_AREADY);
    EventMgr.bind("TestFightM", event.LEAVE_DUNGEON);

    EventMgr.bind("SkyRelicFunctionM", event.DO_BONUS);

    EventMgr.bind("MonsterBuildingM", event.BACK_FLOOR);
    EventMgr.bind("MonsterBuildingM", event.LEAVE_DUNGEON);
    EventMgr.bind("MonsterBuildingM", event.NEXT_FLOOR);
    EventMgr.bind("MonsterBuildingM", event.START_ROUND);


    EventMgr.bind("NormalAudienceM", event.MONSTER_DIE_LOGIC);
    EventMgr.bind("NormalAudienceM", event.MONSTER_DAMAGED);
    EventMgr.bind("NormalAudienceM", event.DUNGEON_AREADY);

    EventMgr.bind("ActivityBossM", event.START_ROUND);
    EventMgr.bind("ActivityBossM", event.DUNGEON_AREADY);
    EventMgr.bind("ActivityBossM", event.BOSS_DIE);

    EventMgr.bind("ChessTableM", event.LEAVE_DUNGEON);
    EventMgr.bind("ChessTableM", event.SUMMON_DIE);

    EventMgr.bind("BraveVSDragonM", event.LEAVE_DUNGEON);
    EventMgr.bind("BraveVSDragonM", event.LEAVE_UNREAL_DUNGEON);
    EventMgr.bind("BraveVSDragonM", event.TRY_LIGHT_CAVE);
    EventMgr.bind("BraveVSDragonM", event.EQUIP);
    EventMgr.bind("BraveVSDragonM", event.UPGRADE_EQUIP);
    EventMgr.bind("BraveVSDragonM", event.BOSS_DIE);
    EventMgr.bind("BraveVSDragonM", event.SAVE_BRAVE_DRAGON);

    EventMgr.bind("TopM", event.SET_RANK_BRIEF);

    EventMgr.bind("RiskerEquipM", event.LEAVE_DUNGEON);
    EventMgr.bind("RiskerEquipM", event.NEXT_FLOOR);

    EventMgr.bind("WaitAndLoadingM", event.MESSAGE_DONE);

    EventMgr.bind("WakuseiM", event.NEXT_FLOOR);
    EventMgr.bind("WakuseiM", event.LEAVE_DUNGEON);
    EventMgr.bind("WakuseiM", event.BACK_FLOOR);

    EventMgr.bind("BishopM", event.LEAVE_DUNGEON);
    EventMgr.bind("BishopM", event.BACK_FLOOR);
    EventMgr.bind("BishopM", event.NEXT_FLOOR);
    EventMgr.bind("BishopM", event.START_PACK_VERIFY_RESULT);
    EventMgr.bind("BishopM", event.DUNGEON_AREADY);
    EventMgr.bind("BishopM", event.ENTER_UNREAL_DUNGEON);

    EventMgr.bind("SaintTacticsM", event.LEAVE_DUNGEON);
    EventMgr.bind("SaintTacticsM", event.BACK_FLOOR);
    EventMgr.bind("SaintTacticsM", event.DUNGEON_PREPARE_OVER);

    EventMgr.bind("EngineeringManualM", event.START_DUNGEON);
    EventMgr.bind("EngineeringManualM", event.CONTINUE_DUNGEON);
    EventMgr.bind("EngineeringManualM", event.LEAVE_DUNGEON);
    EventMgr.bind("EngineeringManualM", event.BONUS_ITEM);
    EventMgr.bind("EngineeringManualM", event.USE_PROPERTY);

    EventMgr.bind("AvalonCannonM", event.START_DUNGEON);
    EventMgr.bind("AvalonCannonM", event.LEAVE_DUNGEON);
    EventMgr.bind("AvalonCannonM", event.START_PACK_VERIFY_RESULT);

    EventMgr.bind("EvilStatueM", event.LEAVE_DUNGEON);
    EventMgr.bind("EvilStatueM", event.DUNGEON_AREADY);

    EventMgr.bind("MagicMirrorM", event.CALL_SUMMON);

    EventMgr.bind("UserProtocolM", event.LOGIN_OK);

    EventMgr.bind("AvalonFortM", event.START_DUNGEON);
    EventMgr.bind("AvalonFortM", event.CONTINUE_DUNGEON);

    EventMgr.bind("IntelligencePCM", event.LEAVE_DUNGEON);

    EventMgr.bind("DungeonGambleM", event.LEAVE_DUNGEON);
    EventMgr.bind("DungeonGambleM", event.NEXT_FLOOR);
    EventMgr.bind("DungeonGambleM", event.BACK_FLOOR);

    EventMgr.bind("PinocchioM", event.LEAVE_DUNGEON);
    EventMgr.bind("PinocchioM", event.ANSWER_FAIRY_QUETION);

    EventMgr.bind("DungeonPuzzleM", event.DO_BONUS);

    EventMgr.bind("SlimeSkillM", event.START_DUNGEON);

    EventMgr.bind("FateChainM", event.NETWORK_DISCONNECTED);

    EventMgr.bind("SummonBlacksmithM", event.LEAVE_DUNGEON);
end
